
% Parameters
h1 = 10; % Hidden layers
eta = 0.01; % Learning rate
es_delay = 10; % Delay before early stopping
plot_result = 1; % Plot the result...

% Run MLP
[W1 b1 W2 b2 listE_train listE_val] = trainMLP(Xtrainset, Ytrainset, Xvalidationset, Yvalidationset, h1, eta, es_delay, plot_result);

% Final errors on training and validation set
out = MLP(Xtrainset', Ytrainset', W1, b1, W2, b2);
E_trainset = mean(out.*(Ytrainset') <= 0);
out = MLP(Xvalidationset', Yvalidationset', W1, b1, W2, b2);
E_validationset = mean(out.*(Yvalidationset') <= 0);
out = MLP(Xtest', Ytest', W1, b1, W2, b2);
E_test = mean(out.*(Ytest') <= 0);

% Print final (Zero/One) errors
fprintf('Error on training set: %f\n', E_trainset);
fprintf('Error on validation set: %f\n', E_validationset);
fprintf('Error on testing set: %f\n', E_test);
